//---------------------------------------------------------------------------- Strict
'use strict'
//---------------------------------------------------------------------------- Package
const _ = require('lodash')
const path = require('path')
const Koa = require('koa')
const router = require('koa-router')()
const convert = require('koa-convert')
//---------------------------------------------------------------------------- App
const app = new Koa()
//---------------------------------------------------------------------------- Config
require('./conf')
//---------------------------------------------------------------------------- Global
require('./global/debug')
require('./global/log')
require('./global/mysql')
//---------------------------------------------------------------------------- Router
_.forOwn(require('./router')(), (value, key) => {
  _.forOwn(value, (v, k) => {
    router[key](k, v)
  })
})
app.use(router.routes())
app.use(router.allowedMethods())
//---------------------------------------------------------------------------- Listen
app.listen(conf.port)
console.log('开始监听：' + conf.port)
